<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>类型列表</title>
	<meta name="description" content="Static & Dynamic Tables" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<!-- basic styles -->
	<hdjs/>
	<link href="__PUBLIC__/css/common.css" rel="stylesheet" />
	<link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet" />
	<link href="__PUBLIC__/css/bootstrap-responsive.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="__PUBLIC__/css/font-awesome.min.css" />
	<!--[if IE 7]>
	  <link rel="stylesheet" href="__PUBLIC__/css/font-awesome-ie7.min.css" />
	<![endif]-->
	<!-- page specific plugin styles -->
	
	<!-- ace styles -->
	<link rel="stylesheet" href="__PUBLIC__/css/ace.min.css" />
	<link rel="stylesheet" href="__PUBLIC__/css/ace-responsive.min.css" />
	<link rel="stylesheet" href="__PUBLIC__/css/ace-skins.min.css" />
	<!--[if lt IE 9]>
	  <link rel="stylesheet" href="__PUBLIC__/css/ace-ie.min.css" />
	<![endif]-->
</head>
<body>

	<div class="container-fluid" id="main-container">
		<a href="#" id="menu-toggler"><span></span></a><!-- menu toggler -->
		<div class="table-header">
			栏目管理 | <a style="font-size:14px;" href="{|U:'Channel/index'}">栏目列表</a>
		</div>
		<!-- PAGE CONTENT BEGINS HERE -->
		<div class="row-fluid">
			<div class="span12">
				<table id="table_bug_report" class="table table-striped table-bordered table-hover">
					<thead>
						<tr>
							<th class="center" style="width:70px">
								<label><input type="checkbox" /><span class="lbl"></span></label>
							</th>
							<th style="width:100px">Nid</th>
							<th>栏目名称</th>
							<th style="width:240px;">栏目排序</th>
							<th style="width:120px;">操作</th>
						</tr>
					</thead>
											
					<tbody>
					<foreach from="$chan" value="$value">
						<tr>
							<form action="{|U:'Channel/ajax_edit_chan'}" onsubmit="return hd_submit(this,'__URL__')" style="margin:0px">
								<td class='center' style="width:70px">
									<label><input type='checkbox' /><span class="lbl"></span></label>
								</td>
								<td style="width:100px">{$value.nid}</td>
								<td>
									<a href='#' class="channame">{$value.nname}</a>
			                        <input type="text" name="nname" value="{$value.nname}" style="display:none;margin-bottom:0px"/>
								</td>
								<td style="width:240px;">
									<a href='#' class="channame">{$value.nsort}</a>
			                        <input type="text" name="nsort" value="{$value.nsort}" style="display:none;margin-bottom:0px"/>
								</td>
								<td style="width:120px;">
									<div class='hidden-phone visible-desktop btn-group'>
										<a href="javascript:" class='btn btn-mini btn-success edit-chan'><i class='icon-edit'>修改</i></a>
										<a class='btn btn-mini btn-danger' onclick="if(confirm('确定要删除该栏目吗?')) hd_ajax('{|U:'ajax_del_chan',array('nid'=>$value['nid'])}')"><i class='icon-trash'>删除</i></a>
									</div>
								</td>
							</tr>
							<input type="hidden" name="nid" value="{$value.nid}"/>
						</form>
					</foreach>
					</tbody>
				</table>
			</div><!--/span-->
		</div><!--/row-->
		
		<!-- PAGE CONTENT ENDS HERE -->
				  


	</div><!-- #main-content -->
	

	<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse">
		<i class="icon-double-angle-up icon-only"></i>
	</a>
	<!-- basic scripts -->
	
	<script src="__PUBLIC__/js/bootstrap.min.js"></script>
	<!-- page specific plugin scripts -->
	
	<script type="text/javascript" src="__PUBLIC__/js/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.dataTables.bootstrap.js"></script>
	<!-- ace scripts -->
	<script src="__PUBLIC__/js/ace-elements.min.js"></script>
	<script src="__PUBLIC__/js/ace.min.js"></script>
	<!-- inline scripts related to this page -->
	
	<script type="text/javascript">
	$(function() {
		var flag = false;
		$('.edit-chan').click(function() {
			var trObj = $(this).parent().parent().parent().find('td');
	        if(!flag){
	            trObj.find('input[type=text]').show();
	            trObj.find('.channame').hide();

	            $(this).removeClass('btn-success').addClass('btn-info').html("<i class='icon-check'> 保存</i>");
	            flag = true;
	        }else{
	           trObj.siblings('form').submit();
	        }
		});
		var oTable1 = $('#table_report').dataTable( {
		"aoColumns": [
	      { "bSortable": false },
	      null, null,null, null, null,
		  { "bSortable": false }
		] } );


		$('table th input:checkbox').on('click' , function(){
			var that = this;
			$(this).closest('table').find('tr > td:first-child input:checkbox')
			.each(function(){
				this.checked = that.checked;
				$(this).closest('tr').toggleClass('selected');
			});
				
		});
		$('[data-rel=tooltip]').tooltip();
	})
	</script>
</body>
</html>